#include <string>
#include <fstream>
#include <windows.h>
#include "SampleWriteLog1.h"


const char* NAME_LOG_FILE = "hieumtLog";
const char* PATH_LOG_FILE = "C:\\HieuMTLog\\";

void Logging::WriteLog(int nLogLevel, char *pFormat, ...) {
	FILE *pf;
	va_list vArg;
	va_start(vArg, pFormat);
	vsprintf(message, pFormat, vArg);
	va_end(vArg);

	SYSTEMTIME st;
	GetLocalTime(&st);
	
	sprintf(fileName, "%s\\%s_%02d%02d", PATH_LOG_FILE, NAME_LOG_FILE, st.wMonth, st.wDay);
	pf = fopen(fileName, "a+t");
	while(pf) {
		fseek(pf, 9, SEEK_END);
		fprintf(pf, "[%02d:%02d:%02d:%03d:%s:%s:%d]", st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,__FILE__, __FUNCTION__, __LINE__);
		fflush(pf);
		fclose(pf);
	}
}

